﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

using Framework.Graphics;

namespace Framework.GameStateManagment.GameScreens
{
    class LoadingScreenBeginn : GameScreen
    {
        public Texture2D Ladebalken;
        public Rectangle RectLadebalken;
        private Texture2D Hintergrund;
        private Texture2D LadebalkenHintergrund;
        private SpriteFont Font, InfoFont;


        public override void LoadContent(ContentManager Content)
        {
            base.LoadContent(Content);
            Ladebalken = Content.Load<Texture2D>(@"GameScreen\LoadingScreenBeginn\LadeBalken");
            Hintergrund = Content.Load<Texture2D>(@"GameScreen\LoadingScreenBeginn\LadeScreen1");
            LadebalkenHintergrund = Content.Load<Texture2D>(@"GameScreen\LoadingScreenBeginn\Hintergrund");
            Font = Content.Load<SpriteFont>(@"Font\Font");
            InfoFont = Content.Load<SpriteFont>(@"Font\InfoFont");
            RectLadebalken = new Rectangle(150, 700, 0, Ladebalken.Height);

        }

        public override void Update()
        {
            if (RectLadebalken.Width <= Ladebalken.Width)
            {
                RectLadebalken.Width = RectLadebalken.Width + 7;
            }
            else
            {
                if (Input.KS.IsKeyDown(Keys.Space))
                {
                    GameStateManagment.GameState = 1;
                }
            }
            base.Update();
        }

        public override void Draw()
        {
            GameStateManagment.SpriteBatch.Begin();
            Camera.TryDraw(Hintergrund, new Vector2(0, 0), Color.White);
            Camera.TryDraw(LadebalkenHintergrund, new Vector2(142, 697), Color.White);
            GameStateManagment.SpriteBatch.Draw(Ladebalken, RectLadebalken, Color.White);
            if (RectLadebalken.Width >= Ladebalken.Width)
            {
                GameStateManagment.SpriteBatch.DrawString(Font, "Press Space to Enter", new Vector2(400, 650), Color.White);
            }
            GameStateManagment.SpriteBatch.DrawString(InfoFont, "Robot War 0.06 alpha", new Vector2(5, 10), Color.White);
            GameStateManagment.SpriteBatch.DrawString(InfoFont, "Programming by Dominik ...", new Vector2(5, 25), Color.White);
            GameStateManagment.SpriteBatch.DrawString(InfoFont, "Graphic Design by Thiago ...", new Vector2(5, 40), Color.White);
            GameStateManagment.SpriteBatch.End();

            base.Draw();
        }
    }
}
